﻿@model IEnumerable<verk2013_project_group12.Models.Game>
@{
    ViewBag.Title = "Games";
}

@section JavaScript
{
    <script src="@Url.Content("~/Scripts/jquery.signalR-1.0.1.min.js")" type="text/javascript"></script>
     <script src="@Url.Content("~/signalr/hubs")" type="text/javascript"></script>
}

<h2>Games</h2>

@foreach (var game in Model)
{
    <div class="game">
        <h3 class="gameTitle">@game.Name</h3>
        <img id="gameImage" src="@game.Image" />
        <div>
            <a href="/Games/GameInfo/@game.ID" class="buttonLink">Info</a> 
            <a href="/Games/Lobby/@game.ID" class="buttonLink">Find</a> 
        </div>
        @if(@game.ID == 1)
        {
            <div class="startNew">
                <a href="@Url.Action("StartNewGame", "Games")" target="_blank" class="buttonLink">Start a new game</a>

            </div>
        }
        @if(@game.ID == 2)
        {
            <div class="startNew">
                 <a href="@Url.Action("StartNewGame", "Games")" target="_blank" class="buttonLink">Start a new game</a>
            </div>
        }
    </div>
}

<div>
    <p id="gameInformation"></p>
</div>